package com.wn.ticket.web;

import com.wn.ticket.common.ResponseEntity;
import com.wn.ticket.entity.*;
import com.wn.ticket.service.ArtistService;
import com.wn.ticket.service.HotSearchService;
import com.wn.ticket.service.PerformService;
import com.wn.ticket.service.SearchHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/front/search")
public class SearchHitoryController {
    @Autowired
    private ArtistService artistService;
    @Autowired
    private SearchHistoryService searchHistoryService;
    @Autowired
    private PerformService performService;
    @Autowired
    private HotSearchService hotSearchService;

    @RequestMapping("/getByArName")
    public ResponseEntity getByArName(String arName) {
        List<Perform> list = performService.getByArName(arName);

        return new ResponseEntity(list);
    }

    @RequestMapping("/getByCity")
    public ResponseEntity getByCity(String name) {
        List<Perform> list = performService.getByCity(name);

        return new ResponseEntity(list);
    }

    @RequestMapping("/getByProfile")
    public ResponseEntity getByProfile(String profile) {
        List<Perform> list = performService.getByProfile(profile);

        return new ResponseEntity(list);
    }

    @GetMapping("/getHistory")
    public ResponseEntity getHistory( int id) {
        List<SearchHistory> list = searchHistoryService.getHistory(id);

        return new ResponseEntity(list);
    }

    @GetMapping("/getHot")
    public ResponseEntity getHot() {
        List<HotSearch> list = hotSearchService.getAll();

        return new ResponseEntity(list);
    }
}
